package javaHomework;

public class Draw {
    private int height;
    public Draw(int height){
        this.height=height;
    }
    int i,j,k;
    public void drawTriangle(){
        for(i=1;i<=height;i++){
           for(j=1;j<=height-i;j++){
               System.out.print(" ");
           }
           for(k=1;k<=2*i-1;k++){
               System.out.print("*");
           }
           System.out.println();
        }
    }
    void drawRectangle(){
        for(i=1;i<=height;i++){
            for(j=1;j<=height;j++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
    public void drawSquare()
    {
        for(i=1;i<=height;i++)
        {
            for(j=i;j<=i+height;j++)
            {
                System.out.print("*");
            }
            System.out.println();
        }
    }
    public void drawParallelogram(){
        for(i=1;i<=height;i++){
            for(j=0;j<=i-1;j++){
                System.out.print(" ");
            }
            for(k=1;k<=height;k++){
                System.out.print("*");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        Draw h=new Draw(4);
        h.drawRectangle();
        System.out.println();
        h.drawTriangle();
        System.out.println();
        h.drawSquare();
        System.out.println();
        h.drawParallelogram();
    }
}
